#include "mytime.h"

MyTime::MyTime():
    ihour           (0),
    iminute         (0),
    isecond         (0)
{
}

bool MyTime::operator>(const MyTime &mt)
{
    bool bgreater = true;
    if(mt.ihour >= this->ihour)
    {
        if(mt.ihour == this->ihour)
        {
            if(mt.iminute >= this->iminute)
            {
                if(mt.iminute == this->iminute)
                {
                    if(mt.isecond >= this->isecond)
                    {
                        bgreater = false;
                    }
                }
                else
                {
                    bgreater  = false;
                }
            }
        }
        else
        {
            bgreater = false;
        }
    }

    return bgreater;
}

QString MyTime::toString()
{
    QString str("");
    if(ihour)
    {
        str += QString("%1:").arg(ihour);
    }

    if(iminute < 10)
    {
        str += QString("0%1:").arg(iminute);
    }
    else
    {
        str += QString("%1:").arg(iminute);
    }

    if(isecond < 10)
    {
        str += QString("0%1").arg(isecond);
    }
    else
    {
        str += QString("%1").arg(isecond);
    }

    return str;
}
